package com.opesoft.fw.validate;

import java.util.Map;

import com.opesoft.fw.ajax.Ajax;
import com.opesoft.fw.core.exception.MessageException;

public class ServerValidate
{
	@Ajax(clientCall=true)
	static public String check(String ruleName,String v,Map<String, Object> ps) throws Exception
	{
		Rule rule;
		try
		{
			rule=(Rule)Class.forName(ruleName).newInstance();
		}
		catch(Exception e)
		{
			throw new MessageException(e,"无效的验证规则："+ruleName);
		}

		return rule.check(v,ps);
	}
}
